package com.sprint.controller;

import com.sprint.dao.StorageDao;
import com.sprint.domain.CommonResult;
import com.sprint.service.StorageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StorageController {

    @Autowired
    private StorageService storageService;

    @PostMapping(value="/storage/decrease")
    public CommonResult decrease(@RequestParam("productId") Long productId,@RequestParam("count") Integer count)
    {
        storageService.decrease(productId,count);
        return new CommonResult(200,"扣减库存成功");

    }
}
